package com.atguigu05.method_more._04recursion.exer2;

import java.util.GregorianCalendar;

/**
 * ClassName: RabbitExer
 * Package: com.atguigu05.method_more._04recursion.exer2
 * Description:
 *
 * @Author 姜
 * @Create 2023/11/20 14:52
 * @Version 1.0
 */
public class RabbitExer {
    public static void main(String[] args) {
        RabbitExer exer = new RabbitExer();
        int month = 24;
        System.out.println("兔子的对数为：" + exer.getRabbitNumber(month));
    }

    public int getRabbitNumber(int month) {
        if (month == 1 || month == 2) {
            return 1;
        } else {
            return getRabbitNumber(month - 1) + getRabbitNumber(month - 2);
        }
    }
}
